/*
 * @Descripttion: 
 * @version: 
 * @Author: mmzhang
 * @Date: 2021-07-23 09:45:29
 * @LastEditTime: 2022-01-18 15:45:03
 */

import Opt from '@/components/dt/info/Opt.js'
import table from '@/components/dt/table/render.js'

let _this = null

class Column extends Opt {
  constructor(vm) {
    super()
    _this = vm
    this.build()
  }

  build() {
    this.createAll()
    this.opts.push(...this.all)
  }

  createAll() {
    this.all = [      
    {
      title: '序号',
      type: 'index',
      width: 80,
      align: 'center',
    },
    {
      title: '城市',
      field: 'parentName',
      minWidth: 120,
      align: 'center',
     
    },
    {
      title: '区域',
      field: 'childrenName',
      minWidth: 120,
      align: 'center',
    },
  
    {
      title: '操作',
      field: 'operation',
      width: 200,
      align: 'center',
      slots: {
        default: (params, h) => {
          let btns = []
          btns.push({
            title:'编辑',
            event: 'regionEdit',
            data: params.row
          })

          btns.push({
            title:'删除',
            event: 'regionDel',
            data: params.row
          })
          return table.cell.btns(_this, h, btns)
        }
      }
    }]
  }

}

export default Column